import java.util.Arrays;

public class Solution2274 {
    public int maxConsecutive(int bottom, int top, int[] special) {
        Arrays.sort(special);
        int t=bottom,ans=0;
        for (int i : special) {
            ans=Math.max(ans,i-t);
            t=i+1;
        }
        ans=Math.max(ans,top-special[special.length-1]);
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2274().maxConsecutive(2,9,new int[]{4,6}));
    }
}
